<template>
  <div class="login-warp">
    <el-form
      class="login-from"
      :label-position="labelPosition"
      label-width="80px"
      :model="fromData"
    >
      <h2>商家登录</h2>
      <el-form-item label="商家用户名">
        <el-input v-model="fromData.username"></el-input>
      </el-form-item>
      <el-form-item label="密码">
        <el-input v-model="fromData.password"></el-input>
      </el-form-item>
      <!-- @click.prevent是点击事件 -->
      <el-button class="login-btn" type="primary" @click.prevent="login">主要按钮</el-button>
    </el-form>
  </div>
</template>

<script>
export default {
  name: "Login",
  data() {
    return {
      labelPosition: "top",
      fromData: {
        username: "",
        password: ""
      }
    };
  },
  methods: {
    login() {
        //这里是登录，可以用get/post
        console.log(this.$http.get);
      console.log("登录");
    }
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.login-warp {
  height: 100%;
  background-color: #344152;
  display: flex;
  justify-content: center;
  align-items: center;
}
.login-warp .login-from {
  background-color: #fff;
  width: 400px;
  padding: 30px;
}
.login-warp .login-from .login-btn {
  width: 100%;
}
</style>